package com.robooot.business_counter.exception;


import java.io.Serializable;
import java.text.MessageFormat;

public class BizException extends RuntimeException implements Serializable {

    private static final long serialVersionUID = 1553364880373814300L;
    private Integer errorCode;
    private String msg;

    public BizException(String msg) {
        this.errorCode = 185;
        this.msg = msg;
    }

    public BizException(DemoError result) {
        this.errorCode = result.getResult();
        this.msg = result.getMessage();
    }

    public BizException(DemoError result, Object... arg) {
        this.errorCode = result.getResult();
        this.msg = MessageFormat.format(result.getMessage(), arg);
    }

    public BizException(Integer errorCode, String msg) {
        this.errorCode = errorCode;
        this.msg = msg;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}

